﻿#-------------------------------------------------------------------------------
# Name:        transform
# Purpose:
#
# Author:      GaiveR
#
# Created:     14.08.2011
# Copyright:   (c) ASM-team 2011
# Licence:     private
#-------------------------------------------------------------------------------
#!/usr/bin/env python

scaleX = 1
scaleY = 1

SCREEN_WIDTH = 640
SCREEN_HEIGHT = 640


def getRealPosition(pos):
    """
    game position -> real position
    """
    return pos[0] * scaleX, pos[1] * scaleY


def getRelativePosition(pos, canvas_pos):
    """
    real position -> game position
    """
    pos = (int((pos[0] - canvas_pos[0]) // scaleX),
           int((pos[1] - canvas_pos[1]) // scaleY))
    return pos


def getRealIntSize(size:tuple) -> tuple: # int size
    size = (int(size[0] * scaleX),
            int(size[1] * scaleY))
    return size


def getRealRect(rect):
    new_rect = rect.copy()
    new_rect.left *= scaleX
    new_rect.top  *= scaleY
    return new_rect

